package com.tongji.housediy.controller
{
	import com.tongji.housediy.events.commonEvent.LoadAdminEvent;
	import com.tongji.housediy.model.ExchangeDataModel;
	import com.tongji.housediy.model.GoodsModel;
	
	import flash.display.Loader;
	import flash.events.Event;
	import flash.net.URLRequest;
	
	import org.robotlegs.mvcs.Command;
	
	/**
	 * 
	 * @author yanghanbing
	 * 2011/6/
	 */ 
	public class LoadAdminCommand extends Command
	{
		[Inject]
		public var event:LoadAdminEvent;
		
		[Inject]
		public var model:GoodsModel;
		
		override public function execute():void
		{
			var loader:Loader = new Loader();
			loader.load(new URLRequest(event.urlSrc));
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadFloorCompleteHandler);
		}
		
		public function loadFloorCompleteHandler(event:Event):void
		{
			model.doorBitMap = event.target.content.bitmapData;
		}
	}
}